package easy;

public class a190_颠倒二进制位 {
    public int reverseBits(int n) {
        int result = 0;
        for (int i = 0; i < 32; i++) {
            //1往左移动i位与n做按位与
            if ((n & (1 << i)) != 0){
                result |= (1 << (31 - i));
            }
        }
        return result;
    }
}
